import subprocess
import os

new_env = os.environ.copy()
new_env['PGPASSWORD'] = '123456'
a = "raster2pgsql -s 4326 -C D:\\tiff\\745511.tif wsiearth | psql -h localhost -p 5432 -U postgres -d Vancouver"
cwd = "D:\\Program Files\\PostgreSQL\\10\\bin"
subprocess.call(a,env=new_env,cwd=cwd,shell=True)
# print(a)